#include <string>
#include <algorithm>
#include <iostream>

bool IsSmaller(std::string& a, std::string& b) {
    if (a.length() != b.length()) {
        return a.length() < b.length();
    }
    return a < b;
}

std::string SubBigNumber(std::string a, std::string b) {

    //判断是否需要加负号
    bool isNegative = false;

    if (IsSmaller(a,b)) {
        std::swap(a, b);
        isNegative = true;
    }

    int aLen = a.size();
    int bLen = b.size();

    //预分配内存
    std::string result(aLen, '0');

    //b补0对齐
    for (int i = 0; i < aLen - bLen; i++) {
        b.insert(b.begin(), '0');
    }

    //借位
    int borrow = 0;
    for (int i = aLen - 1; i >= 0; i--) {
        int num = (a[i] - '0') - (b[i] - '0') - borrow;
        //计算借位
        borrow = num < 0 ? 1 : 0;
        //计算当前位
        num = num < 0 ? num + 10 : num;
        //直接存结果
		result[i] = char(num + '0');	
    }

    //去掉前导0
    while (result.size() > 1 && result[0] == '0') {
        result.erase(result.begin());
    }

    //判断是否需要加负号
    if (isNegative) {
        result = '-' + result;
    }

    return result;
}


/**
 * 输入：
92389122013012030212
100000000000000000001

输出：
-76110877986987969789

大数减法
 */
int main() {

    std::string a, b;

    std::getline(std::cin, a);
    std::getline(std::cin, b);

    std::string result = SubBigNumber(a, b);
    std::cout << result << "\n";

    return 0;
}